package org.jackysoft.report.visitor;

import org.jackysoft.entity.ArmItem;
import org.jackysoft.report.ItemUnit;
import org.jackysoft.report.DataItemType;
import org.jackysoft.report.ReportConstant;
import org.springframework.stereotype.Component;

/** 日报表累计值计算visitor */
@Component(ReportConstant.DailyAccumulateVisitor)
public class DailyAccumulateVisitor extends AbstractArmItemVisitor {

	public DailyAccumulateVisitor(){super();}
	public DailyAccumulateVisitor(ArmItem source) {
		super(source);
	}

	@Override
	public void visite(ItemUnit item) {
		if (getSource() == null){
			this.setSource(new ArmItem());
		}
		ArmItem source = this.getSource();
		ArmItem target = (ArmItem) item;
		DataItemType[] dts = { DataItemType.Action, DataItemType.Passed ,DataItemType.Waster,DataItemType.Test};
		for (DataItemType dt : dts)
			accumulate(dt, source, target);

	}
}
